<template>
  <div>
    <v-fade-transition>
      <div class="loading" v-if="isShow" transition="fade-transition">
        <v-progress-linear indeterminate color="black"></v-progress-linear>
      </div>
    </v-fade-transition>
  </div>
</template>
<script>
export default {
  data() {
    return {
      isShow: false,
      timeout: null
    }
  },
  methods: {
    show() {
      this.isShow = true
    },
    hide() {
      clearTimeout(this.timeout)
      // 加入延时
      this.timeout = setTimeout(() => {
        this.isShow = false
      }, 800)
    }
  }
}
</script>
<style scoped>
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100000;
}
</style>
